package com.sz.biz.pay.util;

import com.sz.biz.pay.account.entity.Transaction;
import com.sz.common.pay.pingan.constant.Constant;

/**
 * Function: 支付相关短信模版 <br>
 *
 * @author: siqishangshu <br>
 * @date: 2018-01-04 14:26:00
 */
public class PayMessageTemplateUtil {

    public static String makeMessage(Transaction transaction) {
        int type = transaction.getTranType();
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("【" + Constant.TRAN_WEB_NAME + "】");
        stringBuffer.append("尊敬的客户您好：您于 " + transaction.getTranDate() + transaction.getTranTime());
        switch (type) {
            case 0:
                stringBuffer.append("向平台会员账户充值 ");
                stringBuffer.append(transaction.getTranAmount() + "(" + transaction.getCurrency() + ")");
                stringBuffer.append(" ");
                stringBuffer.append(getTransactionStatus(transaction.getTranStatus()));
                break;
            case 1:
                stringBuffer.append("从平台会员账户提现 ");
                stringBuffer.append(transaction.getTranAmount() + "(" + transaction.getCurrency() + ")");
                stringBuffer.append(" ");
                stringBuffer.append(getTransactionStatus(transaction.getTranStatus()));
                break;
            case 2:
                stringBuffer.append(" 会员账户发生支付 ");
                stringBuffer.append(transaction.getTranAmount() + "(" + transaction.getCurrency() + ")");
                stringBuffer.append(" ");
                stringBuffer.append(getTransactionStatus(transaction.getTranStatus()));
                break;
            default:
                stringBuffer.append("业务流水异常");
        }
        stringBuffer.append("具体信息请登陆" + Constant.TRAN_WEB_NAME + "进行查看。www.3zang.com");
        return stringBuffer.toString();
    }

    private static String getTransactionStatus(int tranStatus) {
        switch (tranStatus) {
            case 0:
                return "成功";
            case 1:
                return "失败";
            case 2:
                return "待确认";
            case 3:
                return "处理中";
            case 4:
                return "异常";
            default:
                return "异常";
        }
    }

}
